package com.chf.control;

import com.chf.Bean.UserInfoBean;
import com.chf.model.MyModel;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "UserInfoDeleteServlet", value = "/UserInfoDeleteServlet")
public class UserInfoDeleteServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        //物理删除信息
//        int i = MyModel.DeleteUserInfo(id);
        //逻辑删除信息
        int i = MyModel.VDeleteUserInfo(id);
        if (i>0){
            List<UserInfoBean> list = MyModel.SeleteAllUserInfo();
            req.getSession().setAttribute("UserList",list);
            req.getRequestDispatcher("WEB-INF/viewpages/userInfoB/SelectAllUserInfo.jsp").forward(req,resp);
        }
    }
}
